<template>
	<div class="kaochangguanli flex">
    <left></left>
    <div style="width: calc(100vw - 280px); height: calc(100vh - 40px); overflow: auto; padding: 20px;">
      <el-table :data="tableData"  border  style="width: 100%">
          <el-table-column prop="profit_time" label="日期"></el-table-column>

          <el-table-column prop="total_income" label="总金额"></el-table-column>
          <el-table-column prop="user_income" label="用户金额"></el-table-column>
          <el-table-column prop="user_count" label="用户数量"></el-table-column>
          <el-table-column prop="click_count" label="点击次数"></el-table-column>
          <el-table-column prop="valid_click_count" label="有效点击总数"></el-table-column>


          <!-- <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button @click="tuikuan(scope.row)" type="text">退款</el-button>
            </template>

          </el-table-column> -->
      </el-table>
      <el-pagination style="text-align: right; padding: 20px;" background layout="prev,pager,next,total" :current-page="search.page" @current-change="fanye" :page-size="search.page_size" :total="total"></el-pagination>
    </div>


	</div>
</template>

<script>
  import left from '../left.vue'
	export default {
		name: 'kaochangguanli',
    components:{
      left
    },
		data() {
			return {
        tableData:[],
        search:{
          page:1,
          page_size:20,
        },
        total:0
			}
		},
		created() {
      this.getlist()

		},
		mounted() {

		},
		methods: {
      tuikuan:function(item){
        this.$confirm('确定要申请退费吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          axios.post(this.IP_URL+'/api/enrolment/referrefund',{
            id:item.id,
            phone:item.phone,
            name:item.name
          }).then((response)=>{
          	if (response.data.msg.code == 0) {
              this.$message.success('已申请，请等待后台审核');
              this.getlist()
          	} else {
          		this.$message.error(response.data.msg.info);
          	}
          })
        })
      },
      getlist:function(){
        axios.get(this.IP_URL+'/admin/pay/incomelist',{params:this.search}).then((response)=>{
        	if (response.data.msg.code == 0) {
        		this.tableData = response.data.data.data
            this.total = response.data.data.total
        	} else {
        		this.$message.error(response.data.msg.info);
        	}
        })
      },
      fanye:function(val){
        this.search.page = val
        this.getlist()
      },
		}
	}
</script>


<style scoped >

</style>
